<?php
	/**customize computer */
?>
<div class="h_menu_title" style="margin-top:-18px;">
	<a class="" href="#">Giỏ hàng</a>
</div>
<div style="padding-left:5px;border: solid 1px #0286f8;">

<?php 
	$data = null;
	$i = 0;
	foreach($categories as $cate)
	{
		echo "<div style='width:100%;clear:both'>";
		$data = null;
		$data = array('0'=>'----');
		foreach($cate['Product'] as $product)
		{
			$data[$product['id']] = $product['name'];
		}
		// in ra cate name
		echo '<div class="span-1" style="line-height: 25px;width:150px;"> <span >'.$cate['Category']['name'] .':</span> </div>';
		echo '<div class="span-3 last" style="width:230px">'.$form->input('product',array('label'=>false,'id'=> 'cate_' . $cate['Category']['id'],'options'=>$data, 'error' => false,'div'=>false, 'style'=>'width:100%' ));
		echo "</div>";
		echo "";
		echo "</div>";
	}
?>
<div style='width:100%;clear:both'>&nbsp;</div>
</div>
<script type="text/javascript">
	function getSelectedProduct()
	{
		var x = $('select');
		
		var tmp = "";
		
		for(var i=0; i < x.length; i++)
		{
			//b[i] = x[i].value;
			tmp += x[i].value + " ";
		}
		document.getElementById('listProducts').value = tmp;

		$.post("<?php echo $html->url('orderpreview')?>", { products: tmp },
				  function(data){
				    document.getElementById('order_detail').innerHTML += data;
				    document.getElementById('order_detail').style.display = 'block';
				  });
	}
	function close()
	{
		document.getElementById('order_detail').innerHTML = '<a href="javascript:close()" style="color: #fff" >Close</a> <br />';
		document.getElementById('order_detail').style.display = 'none';
	}
	
	function submit_form()
	{
		var x = $('select');
		
		var tmp = "";
		
		for(var i=0; i < x.length; i++)
		{
			//b[i] = x[i].value;
			tmp += x[i].value + " ";
		}
		
		document.getElementById('id_submit').value = tmp;
		document.frm_submit.submit();
	}
</script>
Báo giá
<br/>
<table style="margin-bottom:0px;">
	<tr>
		<td style="border: solid 1px #0286f8; width:50%; text-align:center">
			 <a class="button-ogrange" href="javascript:getSelectedProduct();">&nbsp; XEM LẠI &nbsp; </a>
			 <br />
			 Xem lại các sản phẩm bạn đã chọn
		</td>
		
		<?=$form->create('Product',array('url' => '/home/download','name' => 'frm_submit', 'tyle' => 'post'))?>
			<?php echo $form->hidden('product_id', array('id' => 'id_submit'))?>
		<?=$form->end()?>
		<td style="border: solid 1px #0286f8;text-align:center">
			<a class="button-ogrange" href="javascript:return false;" onclick="submit_form()"> &nbsp; DOWNLOAD&nbsp;  </a>
			<br />
			 Download báo giá các sản phẩm bạn đã chọn.
		</td>
	</tr>
</table>
<div class="end_div_center span-4 last" style="width: 521px;"></div>
<div style="width:100%; clear:both;">
	<form id="calcForm" action="<?php echo $html->url('orderpreview')?>" method="post">
		<input type="hidden" name="products" id="listProducts" />
	</form>
</div>
<div style='width:500px; heigh:600px; position:absolute; top:300px; left: 300px; background:#2b2b2b; display:none; text-align:right' id='order_detail'>
	<a href="javascript:close()" style="color: #fff" >Close</a><br />
</div>
<div id="order_form" style="display:none">
<div> Thông tin khách hàng</div>
<br/>
<?php 
	echo $form->create('Order',array('type'=>'file', 'url'=>'order', 'id'=>'orderForm'));
?>
	<div class='span-1'>Họ và tên</div>
	<div>
		<?php echo$form->input('customer', array('label'=>false, 'type'=>'text')) ?>
	</div>
	<div class='span-1'>Địa chỉ</div>
	<?php echo$form->input('customer_address', array('label'=>false, 'type'=>'text')) ?>
	<div class='span-1'>Số điện thoại</div>
	<?php echo$form->input('customer_tel', array('label'=>false, 'type'=>'text')) ?>
	<div class='span-1'>e-mail</div>
	<?php echo$form->input('customer_email', array('label'=>false, 'type'=>'text')) ?>
	
	<?php echo$form->hidden('status', array('label'=>false, 'type'=>'text', 'value'=>'0')) ?>	
	<?php echo$form->hidden('products', array('label'=>false, 'type'=>'text')) ?>
	
	<input type="button" onclick='getSelectedProduct();' value="Đặt mua " />
	
<?php 
	echo $form->end();
?>
</div>